<?php
namespace app\index\controller;
//error_reporting('0');
class searchController extends \app\base\controller\BaseController
{
    public function index(){

        //热门点击
        $where_hot[]="`type` LIKE  '0' AND  `mall` LIKE  '0'";
        $hot=obj("api/Apidata")->Data_Select("items",$where_hot,"`view` DESC LIMIT 0 , 10");
        $this->hot=$hot;

        $key=urldecode($this->arg("key"));
        $this->key=$key;
        
        if(!$this->arg("type")){
        	$where[]="`productName` LIKE  '%{$key}%'";
        	$baseurl=url($route='index/search/index/key=<key>', $params=array("key"=>$_GET['key']));
        	$f="?";
        }
		

        if($this->arg("type")=="cn"){
        	$where[]="`productName` LIKE  '%{$key}%' and  `mallType` =  '0' ";
        	$baseurl=url($route='index/search/index/key=<key>', $params=array("key"=>$_GET['key']))."?type=cn";
        	$f="&";
        }
          if($this->arg("type")=="us"){
        	$where[]="`productName` LIKE  '%{$key}%' and  `mallType` =  '1' ";
        	$f="&";
        }

        
        $Page = obj('api/ApiData')->PageIndex("50", "goods", $where, "`date` DESC", $baseurl,$f);

        $this->Page=$Page;


    	$this->display();
    }

	

	
	

}